<html>
<head>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function moveToCenter(element)
{
    x = element.offsetParent.offsetLeft + element.offsetLeft + element.offsetWidth / 2;
    y = element.offsetParent.offsetTop + element.offsetTop + element.offsetHeight / 2;
    eventSender.mouseMoveTo(x, y);
}

function runTest() {

    var x, y;
    var span = document.getElementById("span");
    moveToCenter(span);
    eventSender.mouseDown();
    eventSender.mouseUp();
    eventSender.mouseDown();
    eventSender.mouseUp();

    eventSender.leapForward(1000);

    eventSender.mouseDown();

    eventSender.leapForward(500);

    var input = document.getElementById("target");
    moveToCenter(input);
    eventSender.leapForward(500);
    eventSender.mouseUp();
    
    input.contentWindow.postMessage("go", "*");
}
</script>
</head>
<body onload="runTest()">
<span id="span">Dragme</span>
<iframe id="target" src="http://localhost:8000/security/resources/drag-drop.html"></iframe>
</body>
</html>
